<style type="text/css" media="screen">
.n-bottom span.n-error{
    margin-top: -10px !important;
}
hr {
    margin-top: 0px;
    margin-bottom: 15px;
    border: 0;
    border-top: 1px solid #ccc;
}

</style>
<form id="add-form" class="form-horizontal " role="form" data-toggle="validator" method="POST" action="">
    <!--  -->
    <div class="row">
        <div class="form-group col-sm-12">
            <label class="control-label col-xs-12 col-sm-3"><span style="color: red;">*</span>项目名称:</label>
            <div class="col-xs-12 col-sm-9">
                <input class="form-control" id="c-name" name="row[name]" type="text"  placeholder="请填写项目名称" value="" data-rule="required">
            </div>
        </div>

       <div class="form-group col-sm-12">
            <label class="control-label col-xs-12 col-sm-3"><span style="color: red;">*</span>总投资(亿元):</label>
            <div class="col-xs-12 col-sm-9">
                <input class="form-control" id="c-nameinvestment_total" name="row[investment_total]" type="text"  placeholder="请填写总投资(亿元)" value="" data-rule="required" onkeyup="clearNoNum(this)">
            </div>
        </div>

        <div class="form-group col-sm-12">
            <label class="control-label col-xs-12 col-sm-3"><span style="color: red;">*</span>签订框架协议时间:</label>
            <div class="col-xs-12 col-sm-9">
                <input id="c-framework_agreement_time" class="form-control datetimepicker contact" data-date-format="YYYY-MM-DD" data-use-current="true" name="row[framework_agreement_time]" data-rule="required(from, .contact); row[framework_agreement_time]" type="text" value="" data-msg-required="框架/正式至少填一项">
            </div>
        </div>

        <div class="form-group col-sm-12">
            <label class="control-label col-xs-12 col-sm-3"><span style="color: red;">*</span>签订正式投资协议时间:</label>
            <div class="col-xs-12 col-sm-9">
                <input id="c-invesment_agreement_time" class="form-control datetimepicker contact" data-date-format="YYYY-MM-DD" data-use-current="true" name="row[invesment_agreement_time]" type="text" value="" data-rule="required(from, .contact); row[invesment_agreement_time]">
            </div>
        </div>

        <div class="form-group col-sm-12">
            <label class="control-label col-xs-12 col-sm-3"><span style="color: red;">*</span>项目来源:</label>
            <div class="col-xs-12 col-sm-9">
                <select class="form-control" name="row[project_source_ids]" title="请选择" data-rule="required">
                    <option value="">请选择</option>
                    {volist name="activity_list" id="v" }
                        <option value="{$v.id}">{$v.name}</option>
                    {/volist}
                </select>
            </div>
        </div>

        {if $isSuperAdmin}
        <div class="form-group col-sm-12">
            <label class="control-label col-xs-12 col-sm-3"><span style="color: red;">*</span>落户街道:</label>
            <div class="col-xs-12 col-sm-9">
                <select class="form-control" name="row[settle_street_ids]" title="请选择" data-rule="required">
                    <option value="">请选择</option>
                    {volist name="chargedep_list" id="vv" }
                        <option value="{$vv.id}">{$vv.name}</option>
                    {/volist}
                </select>
            </div>
        </div>
        {/if}
    </div>

    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-success">{:__('OK')}</button>
            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
        </div>
    </div>
</form>
<script type="text/javascript">
    function clearNoNum(obj){
        obj.value = obj.value.replace(/[^\d.]/g,"");//清除"数字"和"."以外的字符
        obj.value = obj.value.replace(/^\./g,"");//验证第一个字符是数字而不是字符
        obj.value = obj.value.replace(/\.{2,}/g,".");//只保留第一个.清除多余的
        obj.value = obj.value.replace(".","$#$").replace(/\./g,"").replace("$#$",".");
        obj.value = obj.value.replace(/^(\-)*(\d+)\.(\d\d\d\d).*$/,'$1$2.$3');//只能输入两个小数
    }
</script>
